﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;

namespace PersistanceLayer
{
    [Serializable]
    public class ChatBoxUserData : IChatBoxUserData
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string IconUrl { get; set; }
        public bool IsOnline { get;  set; }
        public string NickName { get; set; }
        public double PositionLatitude { get; set; }
        public double PositionLongitude { get; set; }
        public bool IsRegistered { get; set; }
        public DateTime LastSeen { get;  set; }

        private static object _myLockObject = new object();

        public ChatBoxUserData()
        {
        }
        public ChatBoxUserData(int id,string name, string icon, bool online, string nick, double lat, double lon)
        {
            Id = id;
            Name = name;
            IconUrl = icon;
            IsOnline = online;
            NickName = nick;
            PositionLatitude = lat;
            PositionLongitude = lon;
            LastSeen = DateTime.Now;
        }
        
        internal ChatBoxUserData(int id, string name, string icon, bool online, string nick, double lat, double lon, bool isRegistered)
        {
            Id = id;
            Name = name;
            IconUrl = icon;
            IsOnline = online;
            NickName = nick;
            PositionLatitude = lat;
            PositionLongitude = lon;
            LastSeen = DateTime.Now;
            this.IsRegistered = isRegistered;
        }
        internal ChatBoxUserData( string name, string icon, bool online, string nick, double lat, double lon, bool isRegistered)
        {
           
            Name = name;
            IconUrl = icon;
            IsOnline = online;
            NickName = nick;
            PositionLatitude = lat;
            PositionLongitude = lon;
            LastSeen = DateTime.Now;
            this.IsRegistered = isRegistered;
        }

        public void SetLastSeen(DateTime time)
        {
            LastSeen = time;
        }


        public void SetIsOnline(bool online)
        {
            this.IsOnline = online;
        }
    }
}
